<template>
	<view class="">
		<view class="">
			<view class="back_class" @click="backFn">
				<image class="img-back" src="@/static/images/back.png"></image>
			</view>
		</view>
		<view class="img_class">
			<image class="img" src="https://hunshaimg.sdshengyue.cn//attach/2023/11/5b0f6202311281043188374.png"
				mode="widthFix"></image>
			<image class="img" src="https://hunshaimg.sdshengyue.cn//attach/2023/11/3ce89202311281044043068.png"
				mode="widthFix"></image>
			<image class="img" src="https://hunshaimg.sdshengyue.cn//attach/2023/11/c40d6202311281044384182.png"
				mode="widthFix"></image>
			<image class="img" src="https://hunshaimg.sdshengyue.cn//attach/2023/11/f868d202311281045104365.png"
				mode="widthFix"></image>
		</view>
		<!-- <view class="content">
		    <map id="map" class="map" :show-location="true" :latitude="latitude" :longitude="longitude"></map>
		  </view> -->
		<view class="address-map">
			<!-- <map id="myMap" :longitude="lng" :latitude="lat" :scale="scale">
				<map-marker :longitude="markerLng" :latitude="markerLat"></map-marker>
			</map> -->
			<map id="myMap" :latitude="latitude" :longitude="longitude" :markers="covers">
			</map>
			<view class="map-content">
				<view class="map-left">
					<image class="map-img" src="@/static/images/address-img.png" mode=""></image>
				</view>
				<view class="map-text">
					<!-- 点击进入&nbsp; -->FG全球婚纱&nbsp;展厅定位
				</view>
			</view>
		</view>
		<view class="footer">
			<image class="footer-img" src="https://hunshaimg.sdshengyue.cn//attach/2023/11/f4709202311281103211809.png"
				mode="widthFix"></image>
		</view>

	</view>
</template>

<script>
	import {
		getUserInfo
	} from '@/api/user.js';
	import {
		openExtrctSubscribe
	} from '@/utils/SubscribeMessage.js';
	import {
		toLogin
	} from '@/libs/login.js';
	import {
		mapGetters
	} from "vuex";
	// #ifdef MP
	import authorize from '@/components/Authorize';
	// #endif
	import home from '@/components/home';
	import colors from '@/mixins/color.js'
	export default {
		components: {
			// #ifdef MP
			authorize,
			// #endif
			home
		},
		mixins: [colors],
		data() {
			return {
				userInfo: {},
				yesterdayPrice: 0.00,
				isAuto: false, //没有授权的不会自动授权
				isShowAuth: false, //是否隐藏授权,
				// lng: 118.846488,
				// lat: 31.951667,
				// scale: 16,
				// markerLng: 118.846488,
				// markerLat: 31.951667,
				latitude: 31.951667,
				longitude: 118.846488,
				covers: [{
					latitude: 31.951667,
					longitude: 118.846488,
					iconPath: '@/static/images/adress.png'
				}, {
					latitude: 31.951667,
					longitude: 118.846488,
					iconPath: '@/static/images/adress.png'
				}]
			};
		},
		computed: mapGetters(['isLogin']),
		watch: {
			isLogin: {
				handler: function(newV, oldV) {
					if (newV) {
						this.getUserInfo();
					}
				},
				deep: true
			}
		},
		onLoad() {
			if (this.isLogin) {
				this.getUserInfo()
			} else {
				toLogin();
			}
		},
		methods: {
			backFn() {
				uni.navigateBack(-1)
			},
			onLoadFun: function() {
				this.getUserInfo();
			},
			//跳转
			jumbPath(type) {
				if (type == 1) {
					uni.navigateTo({
						// 提现记录
						url: '/pages/users/user_spread_money/index?type=1'
					})
				} else {
					uni.navigateTo({
						// 分佣等级
						url: '/pages/users/user_distribution_level/index'
					})
				}
			},
			// 授权关闭
			authColse: function(e) {
				this.isShowAuth = e
			},
			openSubscribe: function(page) {
				uni.showLoading({
					title: this.$t(`正在加载`),
				})
				openExtrctSubscribe().then(res => {
					uni.hideLoading();
					uni.navigateTo({
						url: page,
					});
				}).catch(() => {
					uni.hideLoading();
				});
			},
			/**
			 * 获取个人用户信息
			 */
			getUserInfo: function() {
				let that = this;
				getUserInfo().then(res => {
					that.$set(that, 'userInfo', res.data);
					if (!res.data.spread_status) {
						that.$util.Tips({
							title: that.$t(`您目前暂无推广权限`)
						}, {
							tab: 1,
							url: '/pages/index/index'
						});
					}
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	page{
		background-color: #fff;
	}
	#myMap {
		width: 100%;
		// height: 90%;
		height: 524rpx;
	}

	.img {
		// height: 807rpx;
		width: 100%;
		display: block;
		// margin-top: -6rpx;
		// margin-bottom: 18rpx;
	}

	.img-back {
		z-index: 70;
		width: 60rpx;
		height: 65rpx;
	}

	.content {
		width: 100%;
		height: 500rpx;
	}

	.map {
		flex: 1;
	}

	.back_class {
		position: fixed;
		top: 95rpx;
		left: 45rpx;
		z-index: 70;
	}

	.address-map {
		width: 100%;
		// height: 585rpx;
		background-color: #F2EFEA;
	}
.map-content{
	height: 10%;
	display: flex;
	padding: 15rpx 7rpx;
}
.map-left{
	width: 6%;
}
.map-text{
	flex: 1;
	font-size: 26rpx;
	font-family: PingFang SC, PingFang SC;
	font-weight: 400;
	color: #AAAAAA;
}
.map-img{
	width: 28rpx;
	height: 28rpx;
	// width: 10%;
}
	.footer-img {
		width: 100%;
	}
</style>